import React, { useReducer }  from "react";
import {initState,reducer} from "./store"

export default function UseReducerDemo() {
  const [state,dispatch] = useReducer(reducer,initState);
  
  function add(){
    dispatch({
      type:"INC",
      payload:2
    })
  }

  return (
    
      <div>
        <h1>useReducer示例：</h1>
        <p>state.count:{state.count}</p>
        <input type="button" value="加法" onClick={add} />
        
      </div>
  );
}
